﻿using GenerateSamples.Attributes;
using System;
using System.Collections.Generic;

namespace GenerateSamples
{
    class Program
    {
        static void Main(string[] args)
        {
            var result = ObjectGenerator.Instance.GenerateObject<UserEntity>();

            Console.WriteLine("UserEntity.Id={0}", result.Id);
            foreach (var r in result.Logs)
            {
                Console.WriteLine("OperateLogEntity.Id={0}", r.Id);
                Console.WriteLine("OperateLogEntity.Gender={0}", r.Gender);
                Console.WriteLine("OperateLogEntity.Phone={0}", r.Phone);
                Console.WriteLine("OperateLogEntity.CommodityName={0}", r.CommodityName);
            }

            Console.Read();
        }
    }

    public class UserEntity
    {
        [MockIncrement("1000")] //自增长 +初始值
        public long Id { get; set; }

        [MockRandom("1|100")] //随机数（1，100）
        public long UserId { get; set; }

        [MockIncrement("张三")] //固定字段前缀名称
        public string UserName { get; set; }

        [MockImage("300x100/50B347/FFF&text=Banner")]  //随机生成图片 默认指定尺寸即可， 50B347 背景色，FFF 字体色，Banner 图片文字
        public string UserImage { get; set; }

        public List<OperateLogEntity> Logs { get; set; }
    }

    /// <summary>
    /// 操作日志记录表
    /// </summary>
    public class OperateLogEntity
    {
        [MockIncrement("2300")]//自增长 +初始值
        public long Id { get; set; }
        public Guid BusinessId { get; set; }

        [MockChoose("男|女|暂无")] // 自定义数据集合随机选1
        public string Gender { get; set; }

        public string IpAddress { get; set; }

        [MockIncrement("红霞草莓1盒(约400g/盒)")]//自增长 +固定前缀
        public string CommodityName { get; set; }

        [MockMobile] //随机生成手机号
        public string Phone { get; set; }
    }


}
